<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_CSS选择器</title>
    <style>
        h4{
            color: red;
        }
        #d1{
            color: blue; /*文字颜色*/
            width: 100px; /*宽度*/
            height: 100px; /*高度*/
            background-color: pink; /*背景色*/
            border: 5px solid purple; /*边框:宽度 样式 颜色*/
        }
        .error{
            background-color: red;
        }
        .success{
            background-color: green;
        }
        .msg{
            color: white;
        }
        a:link {
            color: gray;
        }
        a:visited {
            color: green;
        }
        a:hover {
            color: orange;
        }
        a:active {
            color: red;
        }
        #d1:hover{
            background-color: lightseagreen;
        }
        h4,#d1,.error{
    1        border: 3px solid cyan;
        }
        *{
            font-style: italic;
        }
        #d2>div>p>span{
            color: red;
         }
    </style>
</head>
<body>
    <div id="d1">我是div</div>
    <div>我是div</div>
    <p>我是段落</p>
    <h4>我是标题</h4>
    <h4>我是标题<</h4>
<hr>
    <span class="error msg">用户名已被占用</span>
    <span class="error msg">两次密码不一致</span>
    <span class="error msg">手机号格式不正确</span>
<br>
    <span class="success msg">有效的邮箱</span>
    <span class="success msg">用户名可以使用</span>
    <span class="success msg">有效的年龄</span>
    <hr>
    <a href="https://www.baidu.com">超链接1</a>
    <a href="abc">超链接2 </a>
<hr>
<div id="d2">
    <span>111</span>
    <div>
        <span>222</span>
        <p>测试文字</p>
        <p>测试<span>333</span></p>
    </div>
    <span>444</span>
</div>
</body>
</html>